package com.jianying.day03;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * ClassName: Flink01_Env
 * Package: com.atguigu.day03
 * Description:
 *
 * @Author: tubage
 * @Create: 2024/4/1 09:21
 * @Version: 1.0
 */
public class Flink01_Env {
    public static void main(String[] args) throws Exception {
        // TODO 本地执行环境，仅在开发时使用
//        LocalStreamEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();
        // TODO 本地执行环境，带webUI，有界执行结束就访问不了WebUI
//        StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(new Configuration());
        // TODO 根据实际运行情况，自动创建环境对象
//        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        // TODO 创建远程执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.createRemoteEnvironment("localhost", 18081, "/Users/china/Atguigu/05_Code/bigdata-flink/target/bigdata-flink-1.0-SNAPSHOT.jar");
        System.out.println(env);
        DataStreamSource<String> wordDS = env.readTextFile("/opt/module/flink-1.17.0/word.txt");
        wordDS.print();
        env.execute();
    }
}
